package com.maben.udp.V2;

import org.springframework.messaging.Message;
import org.springframework.messaging.MessageHandler;
import org.springframework.messaging.MessagingException;
import org.springframework.stereotype.Component;

import java.nio.charset.StandardCharsets;

@Component
public class MyHandler implements MessageHandler {

    @Override
    public void handleMessage(Message<?> message) throws MessagingException {
        String payload = new String((byte[]) message.getPayload(), StandardCharsets.UTF_8);
        System.out.println("接收UDP消息-payload:" + payload);
    }
}